import { fromEventPattern } from 'rxjs';
import elementResizeDetectorMaker from 'element-resize-detector';

export const erd = elementResizeDetectorMaker();

export const resize = (element: HTMLElement) => {
  return fromEventPattern(
    (handler) => erd.listenTo(element, handler),
    (handler) => erd.removeListener(element, handler),
  );
};
